home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / aapain1a / form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-10-10  |  6.7 KB  |  220 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   5  'Sizable ToolWindow
  5.    Caption         =   "Paint"
  6.    ClientHeight    =   7050
  7.    ClientLeft      =   165
  8.    ClientTop       =   690
  9.    ClientWidth     =   9210
  10.    FillStyle       =   0  'Solid
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    MousePointer    =   2  'Cross
  15.    ScaleHeight     =   7050
  16.    ScaleWidth      =   9210
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   3  'Windows Default
  19.    Begin VB.Menu mnuFile 
  20.       Caption         =   "&File"
  21.       Begin VB.Menu mnuFileExit 
  22.          Caption         =   "E&xit"
  23.       End
  24.    End
  25.    Begin VB.Menu mnuPic 
  26.       Caption         =   "&Picture"
  27.       Begin VB.Menu mnupicClear 
  28.          Caption         =   "&Clear"
  29.       End
  30.    End
  31.    Begin VB.Menu mnuToolbar 
  32.       Caption         =   "Toolbar"
  33.       Begin VB.Menu mnutbshow 
  34.          Caption         =   "Show"
  35.       End
  36.       Begin VB.Menu mnutbhide 
  37.          Caption         =   "Hide"
  38.       End
  39.    End
  40. Attribute VB_Name = "Form1"
  41. Attribute VB_GlobalNameSpace = False
  42. Attribute VB_Creatable = False
  43. Attribute VB_PredeclaredId = True
  44. Attribute VB_Exposed = False
  45. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  46. 'Paint v1.0
  47. 'Author: Dustin Davis
  48. 'Bootleg Software Inc.
  49. 'http://www.warpnet.org/bsi
  50. 'This is some simple code to draw pixels on the screen! There are diffrent
  51. 'brush settings, block - small, medium and large, also, star - small, med. and large
  52. 'This is mostly for anyone looking to do something like this. Kind of small and
  53. 'doesnt have very many features, but you can add them yourself!
  54. 'please do not steal this code! If you use it, please give proper credit
  55. 'enjoy!
  56. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  57. Public pBrush As Integer 'for the brush type. 1-6
  58. Public bColor As Long 'back color
  59. Public pColor As Long 'brush color
  60. Private Sub Form_DblClick()
  61. 'popup menu
  62. Form1.PopupMenu mnuPic
  63. End Sub
  64. Private Sub Form_Load()
  65. 'standard place settings
  66. Form1.Top = 0
  67. Form1.Left = Screen.Width / 4
  68. Form2.Visible = True
  69. pColor = 0 'set brush color to black
  70. bColor = Form1.BackColor 'set bcolor to proper color setting
  71. pBrush = 1 'set brush size
  72. End Sub
  73. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  74. On Error GoTo errErrors
  75. 'this is what makes things go!
  76. Dim i As Long
  77. If Button = 1 Then 'if left button pushed
  78.     If pBrush = 1 Then
  79.         'small block brush
  80.         PSet (X, Y), pColor
  81.         i = 0
  82.         Do
  83.             DoEvents
  84.             PSet (X + i, Y), pColor
  85.             PSet (X + i, Y - i), pColor
  86.             PSet (X + i, Y + i), pColor
  87.             PSet (X, Y + i), pColor
  88.             PSet (X - i, Y), pColor
  89.             PSet (X - i, Y - i), pColor
  90.             PSet (X - i, Y + i), pColor
  91.             PSet (X, Y - i), pColor
  92.             i = i + 1
  93.         Loop Until i = 10
  94.     ElseIf pBrush = 2 Then
  95.         'medium block brush
  96.         PSet (X, Y), pColor
  97.         i = 0
  98.         Do
  99.             DoEvents
  100.             PSet (X + i, Y), pColor
  101.             PSet (X + i, Y - i), pColor
  102.             PSet (X + i, Y + i), pColor
  103.             PSet (X, Y + i), pColor
  104.             PSet (X - i, Y), pColor
  105.             PSet (X - i, Y - i), pColor
  106.             PSet (X - i, Y + i), pColor
  107.             PSet (X, Y - i), pColor
  108.             i = i + 1
  109.         Loop Until i = 25
  110.     ElseIf pBrush = 3 Then
  111.     'large block brush
  112.         PSet (X, Y), pColor
  113.         i = 0
  114.         Do
  115.             DoEvents
  116.             PSet (X + i, Y), pColor
  117.             PSet (X + i, Y - i), pColor
  118.             PSet (X + i, Y + i), pColor
  119.             PSet (X, Y + i), pColor
  120.             PSet (X - i, Y), pColor
  121.             PSet (X - i, Y - i), pColor
  122.             PSet (X - i, Y + i), pColor
  123.             PSet (X, Y - i), pColor
  124.             i = i + 1
  125.         Loop Until i = 40
  126.     ElseIf pBrush = 4 Then
  127.         'small star brush
  128.         PSet (X, Y), pColor
  129.         i = 0
  130.         Do
  131.             DoEvents
  132.             PSet (X + i, Y), pColor
  133.             PSet (X, Y + i), pColor
  134.             PSet (X - i, Y), pColor
  135.             PSet (X, Y - i), pColor
  136.             PSet (X + i, Y + i), pColor
  137.             PSet (X - i, Y - i), pColor
  138.             PSet (X + i + i, Y + i + i), pColor
  139.             PSet (X - i - i, Y - i - i), pColor
  140.             i = i + 1
  141.         Loop Until i = 10
  142.     ElseIf pBrush = 5 Then
  143.         'medium star brush
  144.         PSet (X, Y), pColor
  145.         i = 0
  146.         Do
  147.             DoEvents
  148.             PSet (X + i, Y), pColor
  149.             PSet (X, Y + i), pColor
  150.             PSet (X - i, Y), pColor
  151.             PSet (X, Y - i), pColor
  152.             PSet (X + i, Y + i), pColor
  153.             PSet (X - i, Y - i), pColor
  154.             PSet (X + i + i, Y + i + i), pColor
  155.             PSet (X - i - i, Y - i - i), pColor
  156.             i = i + 1
  157.         Loop Until i = 20
  158.     ElseIf pBrush = 6 Then
  159.         'large star brush
  160.         PSet (X, Y), pColor
  161.         i = 0
  162.         Do
  163.             DoEvents
  164.             PSet (X + i, Y), pColor
  165.             PSet (X, Y + i), pColor
  166.             PSet (X - i, Y), pColor
  167.             PSet (X, Y - i), pColor
  168.             PSet (X + i, Y + i), pColor
  169.             PSet (X - i, Y - i), pColor
  170.             PSet (X + i + i, Y + i + i), pColor
  171.             PSet (X - i - i, Y - i - i), pColor
  172.             i = i + 1
  173.         Loop Until i = 40
  174.     End If
  175. ElseIf Button = 2 Then
  176.     'this is the eraser!
  177.     PSet (X, Y), pColor
  178.         i = 0
  179.         Do
  180.             DoEvents
  181.             PSet (X + i, Y), bColor
  182.             PSet (X + i, Y - i), bColor
  183.             PSet (X + i, Y + i), bColor
  184.             PSet (X, Y + i), bColor
  185.             PSet (X - i, Y), bColor
  186.             PSet (X - i, Y - i), bColor
  187.             PSet (X - i, Y + i), bColor
  188.             PSet (X, Y - i), bColor
  189.             i = i + 1
  190.         Loop Until i = 25
  191. End If
  192. errErrors:
  193.     If Err.Number = 28 Then 'stack overflow
  194.         MsgBox "Stack Over flow!" & vbCrLf & "Please reduce draw width size!", vbCritical, "Error"
  195.         Exit Sub
  196.     End If
  197. End Sub
  198. Private Sub Form_Unload(Cancel As Integer)
  199. 'make sure to turn the toolbar off or it will stay on
  200. Unload Form2
  201. End Sub
  202. Private Sub mnuFileExit_Click()
  203. 'exit!
  204. Unload Me
  205. End Sub
  206. Private Sub mnupicClear_Click()
  207. 'clear drawing area
  208. Form1.Cls
  209. End Sub
  210. Private Sub mnutbhide_Click()
  211. 'hide toolbar
  212. Form2.Visible = False
  213. End Sub
  214. Private Sub mnutbshow_Click()
  215. 'show toolbar and place it to its proper setting
  216. Form2.Visible = True
  217. Form2.Top = Form1.Top
  218. Form2.Left = Form1.Left - Form2.Width
  219. End Sub
  220.